﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using ICSharpCode.AvalonEdit.Rendering;
using JiveMessenger.CustomControls;
using JiveMessenger.AvalonEdit;
using JiveMessenger.Models;
using JiveMessenger.User;
using JiveMessenger.ViewModels;
using JmShared;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using System.ComponentModel;
using System.Windows.Media;
using JariZ;

namespace JiveMessenger.ViewModels
{
    public class ViewModelPrivateMessageWindow : ViewModelChatWindow
    {
        private IClient _currentClient;
        public IContact PmTarget { get; set; }



        public ViewModelPrivateMessageWindow(IClient currentClient, ViewModelPrivateMessage vm)
            : base(currentClient)
        {
            this._currentClient = currentClient;
            CurrentActiveViewModel = vm;
            this.PmTarget = vm.PmTarget;
            if (IsInDesignMode)
                return;

            SetStatus(this.PmTarget.ClientStatus == ClientStatus.Offline);
        }


        public override void Cleanup()
        {
            base.Cleanup();
        }

        public override void SetStatus(bool offline)
        {
            base.SetStatus(offline);

            if (offline)
            {
                this.WindowTitle = String.IsNullOrEmpty(this.PmTarget.NickName) ? this.PmTarget.UserName : this.PmTarget.NickName + "<" + this.PmTarget.UserName + "> -Offline-";
            }
            else
            {
                this.WindowTitle = String.IsNullOrEmpty(this.PmTarget.NickName) ? this.PmTarget.UserName : this.PmTarget.NickName + "<" + this.PmTarget.UserName + ">";
            }

        }
    }
}
